<?php
//==============================================
// 代码所有       PHPText.Net
// 代码作者       黄创钦,tine2cx@163.com
// 联系方式       QQ 233944397
// 本代码开源使用，可以随意修改传播，但请保留本版权
// 声明,谢谢合作！
//==============================================


	define("_NavLV_","ViewBoard");  //定义当前页面下拉菜单等级
	include "_Global.php";

	$B_ID=$_GET["bid"];

	$BoardInfo  = TextDB_SearchData("Board","TEXTDB_HID",$B_ID);  //获取板块信息
	$BoardID    = $B_ID;  //获取板块ID
	$BoardTitle = $BoardInfo[0]["分类名称"];
	$BoardAlt   = $BoardInfo[0]["分类描述"];

	$root=explode("",$BoardInfo[0]["SID管理员"]);
	if(!$root[0])
	{
		$root[1] = "暂无";
		$BoardRoot = ''; //获取板块版主
	}
	else
	{
		$BoardRoot = $root[1]; //获取板块版主
	}

	if($root[0])
	{
		$BoardAdminUrl = "profile.php?action=view&uid=".$root[0];
	}
	else
	{
		$BoardAdminUrl = "javascript:;";
	}
	$BoardAdminName    = $root[1];

	//检测是否为论坛管理人员
	if(CheckForumAdmin() or CheckForumRoot())
	{
		$ForumRootModeDisplay = "show";
	}

	//检测是否为分类管理人员
	if(CheckBoardRoot($B_ID) or CheckForumAdmin() or CheckForumRoot())
	{
		$BoardRootModeDisplay = "show";
	}

	$ForumInfo=TextDB_SearchData("Forum_B".$B_ID);  //获取板块信息
	if($ForumInfo)
	{
		foreach($ForumInfo as $K=>$F)
		{
			$F_ID = $F['TEXTDB_HID'];

			//获取子板块模式
			if($F["论坛模式"]==0)
			{
				$Forums[$K]["Sta"]          = "无";
			}
			else
			{
				$Forums[$K]["Sta"]            = "锁";
			}
			$Forums[$K]["ID"]                 = $F_ID;  //获取子板块ID
			$Forums[$K]["Title"]              = $F["论坛名称"];
			$Forums[$K]["Description"]        = $F["论坛描述"];
			$Forums[$K]["Topic"]              = $F["主题数"];
			$Forums[$K]["reTopic"]            = $F["帖子数"];
			$Forums[$K]["TopicToday"]         = $F["今日帖子"];

			//获取最后发帖信息
			$TopicInfo = TextDB_SearchData("Topic_B".$B_ID."_F".$F_ID,NULL,NULL,'DESC',NULL,NULL,1);
			if($TopicInfo)
			{
				$Forums[$K]["IssuedTopicID"]      = $TopicInfo[0][0];  //获取最后帖ID
				$Forums[$K]["IssuedTopicDate"]    = date('Y-m-d H:i:s',$TopicInfo[0]["创建时间"]);
				$Forums[$K]["IssuedTopicTitle"]   = $TopicInfo[0]["主题"];
			}

			$user=explode("",$TopicInfo[0]["SID发表人"]);  //获取发帖人信息
			$Forums[$K]["IssuedTopicMemberID"]   = $user[0];   //获取发帖人ID
			$Forums[$K]["IssuedTopicMemberName"] = $user[1];   //获取发帖人名称

			//获取版主信息
			$admin = explode("",$F["SID版主"]);
			if($admin[0])
			{
				$Forums[$K]["AdminUrl"] = "profile.php?action=view&uid=".$admin[0];  //获取Url地址
			}
			else
			{
				$Forums[$K]["AdminUrl"] = "javascript:;";  //获取无效Url地址
			}

			$Forums[$K]["AdminName"] = $admin[1]; //获取版主名称
		}
	}

	_Header(_ForumTitle_);
	require GetMod('ViewBoard');
	_Footer();
?>